package cn.doit.scala.day06

/**
 * @DATE 2021/12/31/9:25
 * @Author MDK
 * @Version 2021.2.2
 * */
object C01_Sorted {
  def main(args: Array[String]): Unit = {
    implicit val ordering = new Ordering[User] {
      override def compare(x: User, y: User): Int = x.age - y.age
    }
    val list = List[User](User(1, "zss", 23), User(3, "zss", 33), User(2, "zss", 43), User(5, "zss", 28))
    val sorted = list.sorted
    println(sorted)
  }
}
